<!DOCTYPE html>
<head lang="en">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>手机测试</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="format-detection" content="telephone=no"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"/>
    <!--不进行缓存 但是只能清除一次缓存-->
    <meta http-equiv="pragma" content="no-cache"/>
    <meta http-equiv="content-type" content="no-cache, must-revalidate"/>
    <meta http-equiv="expires" content="0"/>
    <!--END 不进行缓存-->
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        body {
            font-size: 10px;;
        }

        #content {
            width: 100%;
            overflow: hidden;
            height: 30em;
            position: relative;
        }

        #imgs {
            position: absolute;
            left: 0;
            transition: left 0.5s;
            -moz-transition: left 0.5s; /* Firefox 4 */
            -webkit-transition: left 0.5s; /* Safari 和 Chrome */
            -o-transition: left 0.5s; /* Opera */
        }

        #imgs img {
            float: left;
        }
    </style>
</head>
<body>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
<div id="content">
    <div id="imgs">
        <img src="images/min_1.jpg" alt="" id="img1" data-value="5">
        <img src="images/min_2.jpg" alt="" id="img2" data-value="4">
        <img src="images/min_3.jpg" alt="" id="img3" data-value="3">
        <img src="images/min_4.jpg" alt="" id="img4" data-value="2">
        <img src="images/min_5.jpg" alt="" id="img5" data-value="1">
    </div>
</div>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>
adafsaf<br>

<script src="js/zepto.min.js"></script>
<script src="js/touch.js"></script>
<script>
    $(document).ready(function () {
        var w = $('#content').width();
        $('#imgs').width(w * $('#imgs img').length);
        $('#imgs img').width(w);
        var a = $('#imgs').position().left;
        if (a == 0) {
            console.log("111");
        }

    });

    function leftFn() {
        var w = $('#content').width();
        var i = $('#imgs img').length;
        state++;
        if (state < i) {
            $('#imgs').css("left", "-" + (w * state) + "px");
        }
        else {
            state--;
        }

    }

    function rightFn() {
        var w = $('#content').width();
        var i = $('#imgs img').length;
        state--;
        if (state >= 0) {
            $('#imgs').css("left", "-" + (w * state) + "px");
        } else {
            state++;
        }
    }

    var state = 0;

    touch.on("#content", "swipeleft", function () {
        leftFn();
    });
    touch.on("#content", "swiperight", function () {
        rightFn();
    });

</script>
</body>
</html>